/**
 * 功能描述
 */
define(function (require, exports, module) {
    //引入视图基类
    var ELView = require("elview");

    //assets
    var template = require("./assets/tpl/checkinimplement_main.tpl");
    require("./assets/css/checkinimplement_main.css");

    //business

    //component
    var cSubnav = require("./component/checkInImplementSubnav");
    var cGrid = require("./component/checkInImplementGrid");
    var cTab = require("./component/checkInImplementTab");
    var ciiBaseForm = require("./component/ciiBaseForm");
    var datilCarGrid = require("./component/datilCarGrid");
    var ciiCarGrid = require("./component/ciiCarGrid");
    var ciiMeetingForm = require("./component/ciiMeetingForm");
    var roomTypeEditGrid = require("./component/roomTypeEditGrid");
    var checkMeetingDetailGrid = require("./component/checkMeetingDetailGrid");
    
    var ciiDinnerCalendar = require("./component/ciiDinnerCalendar");

    var App = ELView.extend({
        attrs: {
            template: template
        },
        events:{
        	"click .breakfast":function(e){
        		ciiDinnerCalendar.dinnerCheckboxClick(e,this,"Breakfast");
        	},
        	"click .lunch":function(e){
        		ciiDinnerCalendar.dinnerCheckboxClick(e,this,"Lunch");
        	},
        	"click .supper":function(e){
        		ciiDinnerCalendar.dinnerCheckboxClick(e,this,"Supper");
        	},
        	"click .left-month":function(e){
        		ciiDinnerCalendar.leftMonth(e,this);
        	},
        	"click .right-month":function(e){
        		ciiDinnerCalendar.rightMonth(e,this);
        	},
        	"click #batch-ready":function(e){
        		ciiDinnerCalendar.batchReady(e,this);
        	}
        },
        handler: require("./handler/checkinimplementHandler"),
        
        store: require("./store/checkinimplementStore"),
        
        service: require("./service/checkinimplementSvc"),
        
        initComponent: function (params, widget) {
        	cSubnav.initComponent(widget);
        	cGrid.initComponent(widget);
        	cTab.initComponent(widget);
        	ciiBaseForm.initComponent(widget);
        	roomTypeEditGrid.initComponent(params,widget);
        	checkMeetingDetailGrid.initComponent(params,widget);
        },
        afterInitComponent: function (params, widget) {
    		widget.get("grid").refresh();
        },
        toCard: function(){
        	this.show([".J-tab"]).hide([".J-grid"]);
        	if(this.get("dataSource") == "GroupReserve"){
        		$("#checkInPerDetailGrid").hide();
        	}else{
        		$("#checkInRoomGrid").hide();
        	}
        	this.get("subnav").show(["save","cancel"])
        		.hide(["startDate","search","status","servicePoint"]);
        },
        toList: function(){
        	this.hide([".J-tab"]).show([".J-grid"]);
        	this.get("subnav").hide(["save","cancel"])
        		.show(["startDate","search","status","servicePoint"]);
        }
    });

    module.exports = App;
});
